<template>
	<view
		class="uni-calendar-item__weeks-box"
		:class="{
			'uni-calendar-item--disable': weeks.disable,
			'uni-calendar-item--isDay': isToday && calendar.fullDate === weeks.fullDate && weeks.isDay,
			'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
			'uni-calendar-item--before-checked': weeks.beforeMultiple,
			'uni-calendar-item--multiple': weeks.multiple,
			'uni-calendar-item--after-checked': weeks.afterMultiple,
			bg: selected && weeks.extraInfo,
			noBg: calendar.fullDate === weeks.fullDate && weeks.isDay,
			'sun-bg': isSun
		}"
	>
		<view class="uni-calendar-item__weeks-box-item">
			<text v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
			<text
				class="uni-calendar-item__weeks-box-text"
				:class="{
					'uni-calendar-item--isDay-text': weeks.isDay,
					'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
					'uni-calendar-item--before-checked': weeks.beforeMultiple,
					'uni-calendar-item--multiple': weeks.multiple,
					'uni-calendar-item--after-checked': weeks.afterMultiple,
					'uni-calendar-item--disable': weeks.disable
				}"
			>
				{{ weeks.date }}
			</text>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		isToday: {
			type: Boolean,
			default: false
		},
		weeks: {
			type: Object,
			default() {
				return {};
			}
		},
		calendar: {
			type: Object,
			default: () => {
				return {};
			}
		},
		selected: {
			type: Array,
			default: () => {
				return [];
			}
		},
		lunar: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			isSun: false
		};
	},
	watch: {
		isToday(to) {}
	},
	created() {
		console.log(this.select);
	},
	methods: {
		choiceDate(weeks) {
			this.$emit('change', weeks);
		}
	}
};
</script>

<style lang="scss" scoped>
.uni-calendar-item__weeks-box {
	flex: 1;
	/* #ifndef APP-NVUE */
	display: flex;
	/* #endif */
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.uni-calendar-item__weeks-box-text {
	font-size: $uni-font-size-base;
	color: #66645d;
}

.uni-calendar-item__weeks-lunar-text {
	font-size: $uni-font-size-sm;
	color: $uni-text-color;
}

.uni-calendar-item__weeks-box-item {
	position: relative;
	/* #ifndef APP-NVUE */
	display: flex;
	/* #endif */
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 90rpx;
	height: 90rpx;
}


.uni-calendar-item--disable {
	background-color: rgba(249, 249, 249, $uni-opacity-disabled);
	color: #ffffff;
	font-size: 24rpx;
}

.uni-calendar-item--isDay-text {
	// color: $uni-color-primary;
}
.bg {
	background: url('//mall-rongchuang.oss-cn-beijing.aliyuncs.com/guixin_miniProgram/img/laugh.png') no-repeat center center;
	background-size: 68% 68%;
	color: #fff;
	.uni-calendar-item__weeks-box-text {
		color: #f9cb80;
		font-size: 22rpx;
		margin-top: -12rpx;
	}
}
.noBg {
	background: none;
	&.uni-calendar-item--isDay {
		.uni-calendar-item__weeks-box-text {
			color: #f9cb80;
			font-size: 22rpx;
			margin-top: -12rpx;
		}
	}
}

.uni-calendar-item--isDay {
	background: url('//mall-rongchuang.oss-cn-beijing.aliyuncs.com/guixin_miniProgram/img/sun-laugh.png') no-repeat center center;
	color: #f9cb80;
	background-size: 100% 100%;
}

.uni-calendar-item--extra {
	color: $uni-color-error;
	opacity: 0;
}

.uni-calendar-item--checked {
	// background-color: $uni-color-primary;
	color: #fff;
	opacity: 0.8;
}

.uni-calendar-item--multiple {
	// background-color: $uni-color-primary;
	color: #fff;
	opacity: 0.8;
}
.uni-calendar-item--before-checked {
	background-color: #ff5a5f;
	color: #fff;
}
.uni-calendar-item--after-checked {
	background-color: #ff5a5f;
	color: #fff;
}
.sun-bg {
	background: url('//mall-rongchuang.oss-cn-beijing.aliyuncs.com/guixin_miniProgram/img/sun-laugh.png') no-repeat center center;
	color: #f9cb80;
	background-size: 105% 105%;
}
</style>
